package com.example.mq.mqServer.mapper;

import com.example.mq.mqServer.core.Binding;
import com.example.mq.mqServer.core.MSGQueue;
import com.example.mq.mqServer.core.exchange.Exchange;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MetaMapper {
    //生成表
    void createExchangeTable();
    void createQueueTable();
    void createBindingTable();

    //交换机
    void insertExchange(Exchange exchange);
    void deleteExchange(@Param("name")String name);
    List<Exchange> selectAllExchange();
    Exchange selectOneExchange(@Param("name") String name);

    //队列
    void insertQueue(MSGQueue queue);
    void deleteQueue(@Param("name")String name);
    List<MSGQueue> selectAllQueue();

    //绑定
    void insertBinding(Binding binding);
    void deleteBinding(Binding binding);//绑定没有自己的主键，由交换机和队列的名字组成主键，所以用Binding对象来作为参数
    List<Binding> selectAllBinding();
    Binding selectOneBinding(Binding binding);
}
